(font-lock-prepend-text-property, font-lock-append-text-property):
authorRichard M. Stallman <rms@gnu.org>
Sat, 29 Dec 2007 19:12:22 +0000 (19:12 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 29 Dec 2007 19:12:22 +0000 (19:12 +0000)
Canonicalize the face and font-lock-face properties.

lisp/font-lock.el

index 6bc5fd8716f0352f29471da6a539ca59bb793f5f..bc7e7f1e3255a0776af398d238325559121f6974 100644 (file)
@@ -1295,6 +1295,12 @@ Optional argument OBJECT is the string or buffer containing the text."
     (while (/= start end)
       (setq next (next-single-property-change start prop object end)
            prev (get-text-property start prop object))
+      ;; Canonicalize old forms of face property.
+      (and (memq prop '(face font-lock-face))
+          (listp prev)
+          (or (keywordp (car prev))
+              (memq (car prev) '(foreground-color background-color)))
+          (setq prev (list prev)))
       (put-text-property start next prop
                         (append val (if (listp prev) prev (list prev)))
                         object)
@@ -1309,6 +1315,12 @@ Optional argument OBJECT is the string or buffer containing the text."
     (while (/= start end)
       (setq next (next-single-property-change start prop object end)
            prev (get-text-property start prop object))
+      ;; Canonicalize old forms of face property.
+      (and (memq prop '(face font-lock-face))
+          (listp prev)
+          (or (keywordp (car prev))
+              (memq (car prev) '(foreground-color background-color)))
+          (setq prev (list prev)))
       (put-text-property start next prop
                         (append (if (listp prev) prev (list prev)) val)
                         object)